#include<iostream>
bool arrayStringsAreEqual(char** word1, int word1Size, char** word2, int word2Size) {
    int i = 0, j = 0;
    char* ret1 = word1[0], * ret2 = word2[0];
    while (i < word1Size && j < word2Size)
    {
        if (*ret1 == '\0')
        {
            if (++i < word1Size)
                ret1 = word1[i];
        }
        if (*ret2 == '\0')
        {
            if (++j < word2Size)
                ret2 = word2[j];
        }
        if (i == word1Size && j == word2Size)
            return 1;
        if (*ret1 != *ret2)
            return 0;
        ret1++;
        ret2++;
    }
    return 0;
}